<%@include file="/WEB-INF/pages/commons/commons.jsp"%>


<jsecurity:lacksPermission name="blog:addLink:${actionBean.blog.id}">
    No "blog:addLink:${actionBean.blog.id}" permission
</jsecurity:lacksPermission>

<jsecurity:hasPermission name="blog:addLink:${actionBean.blog.id}">
<script type="text/javascript">
    $(document).ready(function(){
        $("#saveLink").click(function() {
            $("#display").html('<fmt:message key="global.processing"/>');
            var form = this.form;
            var params = $(form).serializeArray();
            var xhr = $.post(
                '<stripes:url beanclass="foo.bar.blog.web.action.registered.BlogsProfileActionBean" event="saveLink"/>',
                params,
                function(data) {
                    if(xhr.getResponseHeader("X-AjaxRequestStatus")) {
                        // refresh table, hide display
                        $("#display").fadeOut();
                        $("#table").hide();
                        $("#table").html(data);
                        $("#table").fadeIn();
                    }
                    else {
                        // refresh display
                        $("#display").hide();
                        $("#display").html(data);
                        $("#display").fadeIn();
                    }
                });
        });
    });
</script>



<stripes:messages/>
<stripes:form beanclass="foo.bar.blog.web.action.registered.BlogsProfileActionBean">
    <stripes:errors/>

    <input type="hidden" name="link" value=""/>
    <input type="hidden" name="blog" value="${actionBean.blog.id}"/>
    <table width="100%">
        <tr>
            <td><stripes:label name="link.name"/></td>
            <td><stripes:text name="link.name"/></td>
        </tr>
        <tr>
            <td><stripes:label name="link.description"/></td>
            <td><stripes:text name="link.description"/></td>
        </tr>
        <tr>
            <td><stripes:label name="link.link"/></td>
            <td><stripes:text name="link.link"/></td>
        </tr>
        <tr>
            <td colspan="2">
                <stripes:button id="saveLink" name="saveLink"><fmt:message key="add_link.jsp.saveLink"/></stripes:button>
            </td>
        </tr>
    </table>
</stripes:form>
</jsecurity:hasPermission>

